package com.data.hive.utils;

import lombok.extern.slf4j.Slf4j;
import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hadoop.hive.metastore.HiveMetaStoreClient;

/**
 * @author andy
 * @version 1.0
 * @date 2022-01-17 11:49 上午
 */
@Slf4j
public class HiveMetaStoreSource {

    private static final String URIS = "thrift://hadoop000:9083";

    public static HiveMetaStoreClient getClient() {
        HiveMetaStoreClient client = null;
        HiveConf hiveConf = new HiveConf();
        hiveConf.set("hive.metastore.uris",URIS);
        try {
            client = new HiveMetaStoreClient(hiveConf);
        } catch (Exception e) {
            e.printStackTrace();
        }

        log.info("hive metaStore 连接上 success");
        return client;
    }
}
